import request from '@/utils/request'
/**
 * 章节信息api
 */
export default {
  /**
   * 初始化章节信息列表
   * @returns
   */
  initChapterTreeList(courseId) {
    return request({
      url: `/service-edu/admin/edu/chapter/nested-list/${courseId}`,
      method: 'get'
    })
  },
  /**
   * 删除章节
   * @param {*} id
   * @returns
   */
  removeChapterById(id) {
    return request({
      url: `/service-edu/admin/edu/chapter/delete/${id}`,
      method: 'delete'
    })
  },
  /**
   * 添加章节
   * @param {*} chapter
   * @returns
   */
  saveChapter(chapter) {
    return request({
      url: '/service-edu/admin/edu/chapter/save',
      method: 'post',
      data: chapter
    })
  },
  /**
   * 更新章节
   * @param {*} chapter
   * @returns
   */
  updateChapterById(chapter) {
    return request({
      url: '/service-edu/admin/edu/chapter/update',
      method: 'put',
      data: chapter
    })
  },
  /**
   * 查询章节
   * @param {*} id
   * @returns
   */
  getChapterById(id) {
    return request({
      url: `/service-edu/admin/edu/chapter/get/${id}`,
      method: 'get',
    })
  }
}
